//
//  RCTBaiduMapView.h
//  YuanXinBaiduMap
//
//  Created by 晏德智 on 16/9/26.
//  Copyright © 2016年 晏德智. All rights reserved.
//

#if __has_include(<React/RCTViewManager.h>)
#import <React/RCTViewManager.h>
#import <React/RCTComponent.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#else
#import "RCTViewManager.h"
#import "RCTComponent.h"
#import "RCTEventDispatcher.h"
#import "RCTLog.h"
#import "RCTUtils.h"
#endif

#import <BaiduMapAPI_Base/BMKBaseComponent.h>
#import <BaiduMapAPI_Map/BMKMapComponent.h>

#import "RCTConvert+BaiduMapKit.h"

#import "RCTBaiduMapAnnotation.h"
#import "RCTBaiduMapOverlay.h"

RCT_EXTERN const CLLocationDegrees RCTBaiduMapDefaultSpan;
RCT_EXTERN const NSTimeInterval RCTBaiduMapRegionChangeObserveInterval;
RCT_EXTERN const CGFloat RCTBaiduMapZoomBoundBuffer;

typedef void (^UserLocationBlock)(BMKUserLocation *userLocation);

static NSString *const RCTBaiduMapViewKey = @"BaiduMapView";

@interface RCTBaiduMapAnnotationView : BMKAnnotationView

@property (nonatomic, strong) UIView *contentView;

@end

@interface RCTBaiduMapView : BMKMapView

@property (nonatomic, assign) BOOL followUserLocation;
@property (nonatomic, assign) BOOL hasStartedRendering;
@property (nonatomic, assign) BOOL showsZoomControl;
@property (nonatomic, assign) BOOL shouldEmitRegionChange;
@property (nonatomic, assign) BOOL autoZoomToSpan;
@property (nonatomic, strong) BMKLocationViewDisplayParam *userLocationViewParams;
@property (nonatomic, assign) CGFloat minDelta;
@property (nonatomic, assign) CGFloat maxDelta;
@property (nonatomic, assign) UIEdgeInsets legalLabelInsets;
@property (nonatomic, strong) NSTimer *regionChangeObserveTimer;
@property (nonatomic, copy) NSArray<NSString *> *annotationIDs;
@property (nonatomic, copy) NSArray<NSString *> *overlayIDs;

@property (nonatomic, readonly) BOOL firstUserLocated;
@property (nonatomic, copy) UserLocationBlock onFirstUserLocated;

@property (nonatomic, copy) RCTBubblingEventBlock onChange;
@property (nonatomic, copy) RCTBubblingEventBlock onPress;
@property (nonatomic, copy) RCTBubblingEventBlock onAnnotationDragStateChange;
@property (nonatomic, copy) RCTBubblingEventBlock onAnnotationFocus;
@property (nonatomic, copy) RCTBubblingEventBlock onAnnotationBlur;
//GPS 定位信息发生变化事件
@property (nonatomic, copy) RCTBubblingEventBlock onDidChangeUserLocation;

- (void)setAnnotations:(NSArray<RCTBaiduMapAnnotation *> *)annotations;
- (void)setOverlays:(NSArray<RCTBaiduMapOverlay *> *)overlays;

- (void)zoomToSpan;
- (void)zoomToSpan:(NSArray<RCTBaiduMapAnnotation *> *)annotations andOverlays:(NSArray<RCTBaiduMapOverlay *> *)overlays;
- (void)zoomToSpan:(NSArray<CLLocation *> *)locations;
//启动百度地图定位功能
- (void)startUserLocation:(BaiduLocationOptions)options;
- (void)stopUserLocation;

- (void)invalidate;

@end
